#include <stdio.h>
#include "task_kill.h"
#include "FreeRTOS.h"
#include "task.h"

int cmd_kill(int argc, char** argv)
{
    if (argc != 2)
    {
        printf("usage: %s task name\n", argv[0]);
        return -1;
    }
    TaskHandle_t handle = NULL;
    handle = xTaskGetHandle(argv[1]);
    if (handle == NULL)
    {
        printf("not found %s task\n", argv[1]);
        return -1;
    }
    vTaskDelete(handle);
    return 0;
}

SHELL_CMD_EXPORT_ALIAS(cmd_kill, kill, kill task);